Telegram Group & Telegram Channel
ℹ️ Как компьютеры находят простые числа в тысячи раз быстрее, чем ты на бумажке

📌 Что делает решето Эратосфена

Находит все простые числа от 1 до N — быстро, эффективно и без перебора делителей.

➡️ Как это работает

▪️ Создаём массив от 2 до N

▪️ Берём первое невычеркнутое число p

▪️ Вычеркиваем все кратные p

▪️ Переходим к следующему невычеркнутому числу

▪️ Повторяем, пока p² <= N

Пример на Python:
def eratosthenes(n):
sieve = [True] * (n+1)
sieve[0:2] = [False, False]
for i in range(2, int(n**0.5) + 1):
if sieve[i]:
for j in range(i*i, n+1, i):
sieve[j] = False
return [i for i, prime in enumerate(sieve) if prime]


🔵 Чтобы знать об алгоритмах все, забирайте наш курс «Алгоритмы и структуры данных»

Proglib Academy #буст
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/proglib_academy/2771
Create:
Last Update:

ℹ️ Как компьютеры находят простые числа в тысячи раз быстрее, чем ты на бумажке

📌 Что делает решето Эратосфена

Находит все простые числа от 1 до N — быстро, эффективно и без перебора делителей.

➡️ Как это работает

▪️ Создаём массив от 2 до N

▪️ Берём первое невычеркнутое число p

▪️ Вычеркиваем все кратные p

▪️ Переходим к следующему невычеркнутому числу

▪️ Повторяем, пока p² <= N

Пример на Python:

def eratosthenes(n):
sieve = [True] * (n+1)
sieve[0:2] = [False, False]
for i in range(2, int(n**0.5) + 1):
if sieve[i]:
for j in range(i*i, n+1, i):
sieve[j] = False
return [i for i, prime in enumerate(sieve) if prime]


🔵 Чтобы знать об алгоритмах все, забирайте наш курс «Алгоритмы и структуры данных»

Proglib Academy #буст

BY Proglib.academy | IT-курсы




Share with your friend now:
tg-me.com/proglib_academy/2771

View MORE
Open in Telegram


Proglib academy | IT курсы Telegram | DID YOU KNOW?

Date: |

Telegram Auto-Delete Messages in Any Chat

Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Proglib academy | IT курсы from sg


Telegram Proglib.academy | IT-курсы
FROM USA